function searchInsert(nums: number[], target: number): number {
    let length:number = nums.length-1,
        r:number = length,
        l = 0
    while(r>=l){
        let mid :number = (l+r)>>1
        if(nums[mid]===target){
            return mid
        }else if(nums[mid]>target){
            r = mid -1
        }else{
            l = mid +1
        }
    }
    return r + 1
};
console.log(searchInsert([1,3,5,6],7));
